var myOrderList = {
    events: {
        // '#teacherManage #searchBtn click': 'searchBaby',
    },
    init: function () {
        var _this = this;
        Util.event.call(_this, _this.events);
        _this.initTable();
    },
    initTable:function () {
        var _this = this;
        var zTableSetting = {
            async : true,
            showSerialId:false,
            requestParam : {
                enable : true,
                url : interfaceURL.getOrderList()
            },
            head:[
                {key:"create_time",name:"下单时间"},{key:"name",name:"订单内容"},
                {key:"pay_price",name:"支付金额（元）"},{key:"status_label",name:"订单状态"}
            ],
            rowData : [
                {attrName:"row-id",attrKey:"order_no"}
            ],
            operation : [{
                name : "订单详情",
                className : "showDetail",
                callback : _this.showDetail
            }],
            callback : {
                asyncSuccess : function (msg) {
                    if(msg.code == "1"){
                        var _list = msg.data.list;
                        $.each(_list,function (i,v) {
                            if(!Util.isEmpty(v.status_label)){
                                if(v.status_label == "未到店"){
                                    v.status_label = "<span class='indent-state'>未到店</span>";
                                }else if(v.status_label == "已到店"){
                                    v.status_label = "<span class='indent-state in'>已到店</span>";
                                }else if(v.status_label == "处理中"){
                                    v.status_label = "<span class='indent-state handing'>处理中</span>";
                                }
                            }
                            var times = v.create_time.split(" ");
                            v.create_time = "<div class='time-item clearfix'><div class='time-item-right'><div class='time-line-top'></div><div class='time-line-middle'></div><div class='time-line-bottom'></div></div><div class='time-item-left'><div class='time-item-date'>"+times[0]+"</div><div class='time-item-time'>"+times[1]+"</div></div></div>";
                            v.name = "<div class='order-content-item clearfix'><div class='order-item-img' style='background: url("+v.shop_cover+") no-repeat center;background-size: 100%;'></div><div class='order-item-block'><div class='order-item-block-top'>"+v.shop_name+"</div><div class='order-item-block-middle'>"+v.goods_name+"</div><div class='order-item-block-bottom'>"+"订单号："+v.order_no+"</div></div></div>";
                        });
                        $(".my-order-title-text .order-number").html(msg.data.total);
                        return {
                            zColumns : _list,
                            pageInfo : {
                                pageSize:10,
                                pageNum:msg.data.current_page,
                                totalPage:msg.data.total_page,
                                totalRecords:msg.data.total
                            }
                        }
                    }
                }
            }
        };
        $.fn.zTable.init($(".my-table-list"), zTableSetting);
    },
    showDetail:function ($tr) {
        var id = $tr.attr("row-id");
        window.location.href = "http://47.96.128.76/member/order_detail?order_no=" + id;
    }
}